<?php
require_once '../sub/init.php';
require_once 'chkUadm.php';
if(!in_array('log',$QXARR))exit(noauth());
require_once ZEAI.'m/div_left_so.php';
function rows_ulist($rows,$p) {
	global $db,$Skey;
	$ustr='';
	$id = $rows['id'];
	$uid = $rows['uid'];
	$tguid = $rows['tguid'];
	$username = $rows['username'];
	$content = dataIO($rows['content'],'out');
	if(ifint($uid)){
		$row = $db->ROW(__TBL_USER__,"nickname,grade,sex","id=".$uid,'num');
		if($row){
			$nickname= $nickname= dataIO($row[0],'out');;$grade= $row[1];$sex= $row[2];
			$ustr = uicon($sex.$grade);
			$ustr.= $nickname."　<span class='S12 C999'>(uid：".$uid.")</span>";
		}
	}
	if(ifint($tguid)){
		$row = $db->ROW(__TBL_TG_USER__,"uname,nickname","id=".$tguid,'num');
		if($row){
			$uname= $nickname= dataIO($row[0],'out');$nickname= dataIO($row[1],'out');
			$nickname = (empty($nickname))?$uname:$nickname;
			$ustr = $nickname."　<span class='S12 C999'>(id：".$tguid.")</span>";
		}
	}
	$username = str_replace($Skey,"<font color=red><b>".$Skey."</b></font>",$username);
	$content = str_replace($Skey2,"<font color=red><b>".$Skey2."</b></font>",$content);
	$content = str_replace($Skey3,"<font color=red><b>".$Skey3."</b></font>",$content);
	$content = str_replace('->',' <img src="images/d2.gif"> ',$content);
	$addtime = YmdHis($rows['addtime']);
	$O = '<dl><dt><font class="C333">● '.$content.'</font>'.$ustr.'<font class="C999">'.$addtime.'</font></dt><dd><div class="ico">'.$username.'</div></dd></dl>';
	return $O;
}
$nodatatips= "<div class='nodataico'><i class='ico'>&#xe608;</i>暂无信息</div>";
$_ZEAI['pagesize'] = 15;

$ZEAI_SQL = " 1=1 ";
$Skey = trimm($Skey);
if(!empty($Skey)){
	$ZEAI_SQL .= " AND ( username LIKE '%".$Skey."%' )";
}
if (ifint($Skey2)){
	$ZEAI_SQL .= " AND (uid=$Skey2) ";
}elseif(!empty($Skey2)){
	$ZEAI_SQL .= " AND ( content LIKE '%".$Skey2."%' )";
}
if (ifint($Skey3)){
	$ZEAI_SQL .= " AND (tguid=$Skey3) ";
}elseif(!empty($Skey3)){
	$ZEAI_SQL .= " AND ( content LIKE '%".$Skey3."%' )";
}
if(!empty($Skey4)){
	$ZEAI_SQL .= " AND ( content LIKE '%".$Skey4."%' )";
}
//门店+地区
if ($session_kind=='crm' && !CRM_ADM){
	$ZEAI_SQL.=" AND agentid=$session_agentid ";
}
//超管可以按门店搜索
if(ifint($agentid) && CRM_ADM)$ZEAI_SQL .= " AND agentid=$agentid";
//
$ZEAI_SELECT="SELECT * FROM ".__TBL_LOG__." WHERE ".$ZEAI_SQL." ORDER BY id DESC";
if($submitok=='ZEAI_list'){exit(Zeai_ajax_list_fn($ZEAI_totalP,$p));}
$ZEAI_total = $db->COUNT(__TBL_LOG__,$ZEAI_SQL);
$ZEAI_totalP= ceil($ZEAI_total/$_ZEAI['pagesize']);
//
$nav='index';
?>
<!doctype html><html><head><meta charset="utf-8">
<title><?php echo $_ADM['admSiteName']; ?></title>
<?php echo HEADMETA; ?>
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<?php require_once 'm_style.php';?>
<link href="css/m_adm.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<style>
/*ZEAI_list*/
.ZEAI_list{padding:50px 0 80px;width:94%;margin:0 auto;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}
.ZEAI_list dl{width:100%;padding:10px 15px;box-sizing:border-box;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;clear:both;overflow:auto;border-bottom:#f8f8f8 1px solid}
.ZEAI_list dl:last-child{border-bottom:0}
.ZEAI_list dl dt,.ZEAI_list dl dd{float:left;display:block}
.ZEAI_list dl:hover{background-color:#f8f8f8}
.ZEAI_list dl dt{width:80%;text-align:left;line-height:200%;font-size:12px;color:#999}
.ZEAI_list dl dt font{font-size:13px;display:block}
.ZEAI_list dl dd{width:18%;text-align:right;font-size:13px;padding:15px 0 10px}
.ZEAI_list .nodatatips i{font-size:120px;line-height:120px}
</style>
</head>
<body>
<?php 
$mini_title='操作日志';$mini_class='top_mini4 ';
require_once ZEAI.'m/top_mini.php';?>
<a class="so" id="user_search"><i class="ico">&#xe66c;</i><span>筛选</span></a>
<div class="ZEAI_list" id="ZEAI_list"><?php if($ZEAI_totalP>0){echo Zeai_ajax_list_fn($ZEAI_totalP,$p);}else{echo $nodatatips;}?></div>
<!--div_left_so-->
<div id="rangebox"></div>
<div class="div_left_so" id="user_so">
	<form action="m_log.php" method="get" name="www.yzlove.com" id="ZEAI_CN_FORM_ext">
    	<div class="form_uid">
        <input name="Skey4" type="text" class="input" id="Skey4" maxlength="20" value="<?php echo $Skey4;?>" placeholder="按日志内容" autocomplete="off">
        <button type="submit" class="ico">&#xe6c4;</button>
		</div>
    	<div class="form_uid">
        <input name="Skey" type="text" class="input" id="Skey" maxlength="20" value="<?php echo $Skey;?>" placeholder="按管理员和红娘用户名" autocomplete="off">
        <button type="submit" class="ico">&#xe6c4;</button>
		</div>
    	<div class="form_uid">
        <input name="Skey2" type="text" class="input" id="Skey2" maxlength="20" value="<?php echo $Skey2;?>" placeholder="按用户UID/昵称" autocomplete="off">
        <button type="submit" class="ico">&#xe6c4;</button>
		</div>
    	<div class="form_uid">
        <input name="Skey3" type="text" class="input" id="Skey3" maxlength="20" value="<?php echo $Skey3;?>" placeholder="按推广员ID/昵称" autocomplete="off">
        <button type="submit" class="ico">&#xe6c4;</button>
		</div>
        <?php
		if(CRM_ADM){
			$rt2=$db->query("SELECT id,title FROM ".__TBL_CRM_AGENT__." WHERE flag=1 ORDER BY px DESC,id DESC");
			$total2 = $db->num_rows($rt2);
			if ($total2 > 0) {
				for($j=0;$j<$total2;$j++) {
					$rows2 = $db->fetch_array($rt2,'name');
					if(!$rows2)break;
					$agentARR[] = array('i'=>$rows2['id'],'v'=>$rows2['title']);
				}
				div_left_so_out(array('tbody'=>'所属门店','t'=>'agentid','tv'=>$agentid,'subkind'=>2,'newarr'=>json_decode(encode_json($agentARR)),'ulcls'=>' col3'));
			}
		}?>
        <script>div_left_so_init('user_so')</script>
        <div class="savebox"><button type="button" class="btn size3 reset" onClick="div_left_so_reset('user_so')">重置</button><button type="submit" class="btn size3 zeaibg ico">&#xe6c4; 确定</button></div>
    </form>
</div>
<script>user_search.onclick=function(){ZeaiM.div_left({obj:user_so,w:28});}</script>
<!--div_left_so end-->
<script>
<?php
if ($ZEAI_total > $_ZEAI['pagesize']){?>
var ZEAI_totalP = parseInt(<?php echo $ZEAI_totalP; ?>),p=2;
zeaiOnscroll_json={url:'m_log'+zeai.ajxext+'',data:{submitok:'ZEAI_list',ZEAI_totalP:ZEAI_totalP,Skey:Skey.value,Skey2:Skey2.value,Skey3:Skey3.value,Skey4:Skey4.value}};
document.body.onscroll = zeaiOnscroll;
<?php }?>
</script>
<div id="backtop"><a id="btmTopBtn"><i class="ico">&#xe60c;</i>顶部</a></div>
<?php //require_once 'm_btm.php';?>
</body>
</html>